package com.gateway.common.enums;

/**
 * @program: api-gateway
 * @description:
 * @author: YuKai Fan
 * @create: 2025/2/10 22:30
 **/
public enum AuthorizationTypeEnum {

    NONE("none"),
    API("api"),
    SCOPE("scope"),
    ;

    private final String type;

    AuthorizationTypeEnum(String type) {
        this.type = type;
    }

    public String getType() {
        return type;
    }

    public static AuthorizationTypeEnum getByType(String value) {
        for (AuthorizationTypeEnum authTypeEnum : AuthorizationTypeEnum.values()) {
            if (authTypeEnum.getType().equals(value)) {
                return authTypeEnum;
            }
        }
        return AuthorizationTypeEnum.NONE;
    }

    public boolean isAuth() {
        return !NONE.equals(this);
    }
}
